package event

import (
	"encoding/json"
	"time"
)

type JsonlLoadedEvent struct {
	EventID    string    `json:"event_id"`
	EntityID   string    `'json:"entity_id"`
	EventBody  string    `json:"event_body"`
	EventType  string    `json:"event_type"`
	EventTime  time.Time `json:"event_time"`
	EventState int       `json:"event_state"`
}

func (j JsonlLoadedEvent) String() string {
	marshal, err := json.Marshal(j)
	if err != nil {
		return ""
	}
	return string(marshal)
}

func (j JsonlLoadedEvent) ID() string {
	return j.EventID
}

func (j JsonlLoadedEvent) GetEventName() string {
	return "domain-event:json-to-csv"
}

func (j JsonlLoadedEvent) GetEntityID() string {
	return j.EntityID
}

func (j JsonlLoadedEvent) OccurredOn() time.Time {
	return j.EventTime
}
